<!DOCTYPE html>
<html lang='en'>

<head>
    <meta charset='UTF-8'>
    <meta name='viewport' content='width=device-width, initial-scale=1.0'>
    <title>Document</title>
    <script type='text/javascript' src='js/vue.js'></script>
</head>

<body>
    <div id='app'>
        {{msg}}

        <ul>
            <li  v-for="(aa,i) in arr" :key="aa.id">
                <input type="checkbox"  id="" v-model="aa.chk" @change="kk">
                <span>品牌：{{aa.name}}</span>
                <span>单价是：{{aa.price}}元</span>
                <span>数量是：{{aa.num}}元</span>

                <div>{{aa.chk}}</div>
            </li>

        </ul>

        <p>总价是：{{total}}元</p>  
    </div>
    <script type='text/javascript'>
        var vm = new Vue({
            el: '#app',
            data: {
                msg: 'Hello Vue',
                total:0,
                arr: [
                    {
                        id: 1,
                        name:"nick",
                        price:50,
                        num:2,
                        chk:false,
                    },
                    {
                        id: 2,
                        name:"adi",
                        price:60,
                        num:3,
                        chk:false,

                    },
                    {
                        id: 3,
                        name:"anta",
                        price:70,
                        num:4,
                        chk:false,
                    }
                    ,
                    {
                        id: 4,
                        name:"step",
                        price:80,
                        num:5,
                        chk:false,
                    }
                    ,
                    {
                        id: 5,
                        name:"361",
                        price:90,
                        num:6,
                        chk:false,
                    }
                ]
            },
            methods:{
                kk(){
                    this.total=0;
                  this.arr.forEach(item => {
                      if(item.chk){
                          this.total+=Number(item.price)*Number(item.num);
                      }
                  });
                  
                }
            }
        });
    </script>
</body>

</html>